package nix.demo7.web.filter;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

public class StaticResponse extends HttpServletResponseWrapper {

	private PrintWriter pw;

	public StaticResponse(HttpServletResponse response, String path)
			throws FileNotFoundException, UnsupportedEncodingException {
		super(response);
		// 创建一个指向html文件的流对象，用于输出html文件
		pw = new PrintWriter(path, "utf-8");
	}

	@Override
	public PrintWriter getWriter() throws IOException {
		// 修改getWriter方法，返回指向html的流对象
		return pw;
	}
}
